<?php
/**
 * 产品
 * User: lyl
 * Date: 2019-04-29
 */

namespace Biz\module\Classes\WikiClean;

class Goods
{
    /**
     * 执行统一操作
     **/
    public static function run($params, &$data){
        self::_add($params, $data);
    }

    /**
     * 插入表
     **/
    private static function _add($params, &$data){
        $source_data = json_decode($params['source_data'], true);

        $data['goods'] = [
            'res_id'=> $params['id'],
            'type'=> $params['type'],
            'url'=> isset($params['url'])?$params['url']:'',
            'goods_id'=> $params['item_id'],
            'name'=> $params['name'],
            'shop_id'=> $params['shop_id'],
            'shop_name'=> $params['shop_name'],
            'max_price'=> $params['original_max_price'],
            'min_price'=> $params['original_min_price'],
            'stock'=> $params['stock'],
            'shipping_address'=> $params['shipping_address'],
            'detail'=> isset($source_data['detail'])?$source_data['detail']:'',
            'add_time'=> date('Y-m-d H:i:s'),
            'edit_time'=> date('Y-m-d H:i:s'),
        ];
    }

}